<?php

require_once(dirname(__FILE__) . "/../../commons/common-funcs.php");
require_once(dirname(__FILE__) . "/../../db/common-operations.php");
require_once(dirname(__FILE__) . "/../../db/bookmarksOperations.php");
require_once(dirname(__FILE__) . "/../../db/tagsOperations.php");
require_once(dirname(__FILE__) . "/../../db/associations.php");

function testInsertIntoTable() {
    //testing an insert into webpage
    $testCaseResult=insertIntoTable("webpage", "url, title", 
            "'http://www.ritholtz.com/blog/2011/05/sloppy-market-blame-the-financials/',"
            ."'Sloppy Market? Blame the Financials | The Big Picture'"
            );
    
    
//    displayInProgressNotice();
    return $testCaseResult;
}

function testDbCreateWebPage($testcaseUrl, $testcaseTitle) {
    //the 2 fields expected by the function. In practice, these fields may come from an AJAX request, for example.
    $stubAjaxRequest=array();
    $stubAjaxRequest['url']=$testcaseUrl;
    $stubAjaxRequest['title']=$testcaseTitle;
        
    $testCaseResult=dbCreateWebPage($stubAjaxRequest);
    
    //    displayInProgressNotice();
    return $testCaseResult;
}

function testDbCreateTag($testcaseTag) {
    //the 2 fields expected by the function. In practice, these fields may come from an AJAX request, for example.
    $stubAjaxRequest=array();
    $stubAjaxRequest['tag']=$testcaseTag;
            
    $testCaseResult=dbCreateTag($stubAjaxRequest);
    
    //    displayInProgressNotice();
    return $testCaseResult;
}


function testDbCreateWebpageHasTags($testcaseWebpageId, $testcaseTagsId) {
    //the 2 fields expected by the function. In practice, these fields may come from an AJAX request, for example.
    $stubAjaxRequest=array();
    $stubAjaxRequest['webpage_id']=$testcaseWebpageId;
    $stubAjaxRequest['tags_id']=$testcaseTagsId;
            
    $testCaseResult=dbCreateWebpageHasTags($stubAjaxRequest);
    
    //    displayInProgressNotice();
    return $testCaseResult;
}

function displayInProgressNotice() {
    echo buildHtmlPresentationForError(__FILE__, __FUNCTION__, "function testInsertIntoTable(): implementation in progress...");
    exit();
    
}
?>
